﻿<UserControl x:Class="PwdMgrUI.Login"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:vr="clr-namespace:PwdMgrUI.ValidationRules"
             xmlns:utils="clr-namespace:PwdMgrUI.Utils"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="3*"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0">
            <TextBlock Name="tblk_ErrMsg" HorizontalAlignment="Left" Foreground="Red" />
        </StackPanel>
        <Grid Grid.Row="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"></ColumnDefinition>
                <ColumnDefinition Width="2*"></ColumnDefinition>
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <TextBlock Grid.Row="0" Grid.Column="0" Text="Username:"
                       Style="{StaticResource STBLK_Global}"
                       HorizontalAlignment="Right" />
            <TextBlock Grid.Row="1" Grid.Column="0" Text="Password:"
                       Style="{StaticResource STBLK_Global}" HorizontalAlignment="Right" />
            <TextBox Grid.Row="0" Grid.Column="1" Name="tbox_Username"
                     Style="{StaticResource STBOX_Global}">
                <TextBox.Text>
                    <Binding Path="Username">
                        <Binding.ValidationRules>
                            <vr:CommonStringValidationRule 
                                ErrMsg="User name cannot be null." />
                        </Binding.ValidationRules>
                    </Binding>
                </TextBox.Text>
            </TextBox>
            <PasswordBox Grid.Row="1" Grid.Column="1"
                         Name="pbox_Password"
                         Style="{StaticResource SPBOX_Global}" >
            </PasswordBox>
        </Grid>
        <Grid Grid.Row="2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Button Grid.Column="0"
                    Content="{Binding Converter={StaticResource I18N}, ConverterParameter=Login}"
                    Name="btn_Login"
                    Style="{StaticResource SBTN_Global}"
                    Command="{Binding OKCommand}" />
            <Button Grid.Column="1"
                    Content="{Binding Converter={StaticResource I18N}, ConverterParameter=Reset}"
                    Name="btn_Reset"
                    Style="{StaticResource SBTN_Global}" />
            <Button Grid.Column="2" Content="Register" 
                    Name="btn_Register" Style="{StaticResource SBTN_Global}" />
        </Grid>
    </Grid>
</UserControl>
